package sampleapp.client;


import sampleapp.client.mvp.ViewImpl;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;

public class PeopleView extends ViewImpl implements PeoplePresenter.MyView {

	private final Widget widget;
	
	
	
	private static final PeopleViewUiBinder UIBINDER = GWT
	.create(PeopleViewUiBinder.class);
	
	interface PeopleViewUiBinder extends UiBinder<Widget, PeopleView> {
	}
	
	@UiField
	FlowPanel lstPeople;
	
	@Inject
	public PeopleView() {
		this.widget = UIBINDER.createAndBindUi(this);
	}

	@Override
	public Widget asWidget() {
		return widget;
	}

	@Override
	public void addToSlot(Object slot, Widget content) {
		// TODO Auto-generated method stub
	    super.addToSlot(slot, content);
		if (content==null) {
			System.out.println("Empty/null content");
		}
		if (lstPeople==null){
			System.out.println("lstPeople is null");
		}
	    this.lstPeople.add(content);
	}

	@Override
	public void setInSlot(Object slot, Widget content) {
		// TODO Auto-generated method stub
	    super.setInSlot(slot, content);
		this.lstPeople.clear();
	}
	
	
}
